How To Build OpenAL Soft for ARM


Intro


In this How To we are going to build OpenAL Soft 1.15.1 with our GCC/G++ 4.8.2 cross-compiler. Be sure to start this build in a new terminal/tab to avoid any pollution from previous builds.

Tar Balls


Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
  • openal-soft-1.15.1.tar.bz2

NOTE: This build uses cmake. Get it from your distro's repo.

Create a Workspace


I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
$ export OPENAL_SOFT_SRC=~/workbench/openalsoft/src
$ mkdir -pv ~/workbench/openalsoft
$ mkdir $OPENAL_SOFT_SRC
$ cd $OPENAL_SOFT_SRC

Gather the Sources


Now that we have a workspace created and we are currently in the src directory we can begin bringing down the sources and extracting them.

openalsoft

$ wget kcat.strangesoft.net/openal-releases/openal-soft-1.15.1.tar.bz2
$ tar -pxjf openal-soft-1.15.1.tar.bz2

Build Environment


To make things a little smoother let's setup some environment variables:
$ export INSTALLDIR=~/workbench/gcc-g++-4.8.2/arm
$ export PATH=$INSTALLDIR/bin:$PATH
$ export TARGETMACH=arm-none-linux-gnueabi
$ export BUILDMACH=i686-pc-linux-gnu
$ export CROSS=arm-none-linux-gnueabi
$ export CC=${CROSS}-gcc
$ export LD=${CROSS}-ld
$ export AS=${CROSS}-as
$ export CXX=${CROSS}-g++
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change INSTALLDIR to point to your cross-compiler.

Build OpenAL Soft


First we need to make a "toolchain file":
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
 
# specify the cross compiler
SET(CMAKE_C_COMPILER   /home/<your user>/workbench/gcc-g++-4.8.2/arm/bin/arm-none-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER /home/<your user>/workbench/gcc-g++-4.8.2/arm/bin/arm-none-linux-gnueabi-g++)
 
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH  /home/<your user>/workbench/gcc-g++-4.8.2/arm)
 
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Copy & paste the above contents into a plain text file. Save the file as cross.cmake in the build directory, i.e. ../openal-soft-1.15.1/build

Next, build:
$ cd openal-soft-1.15.1/build/
$ cmake -DCMAKE_TOOLCHAIN_FILE=cross.cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/<your user>/workbench/openalsoft/final ..
$ make && make install

Output


cd into the final directory and output its contents:
$ cd ../final/
$ ls
You should have the following directories:
  • bin
  • include
  • lib
  • share

Make sure the binaries are for ARM:
$ cd bin/
$ file makehrtf
bash: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
If you see something *similar* to above you're good to go ;-)

Lastly, move the contents of these directories, or the directories themselves if they do not already exist, to your custom Linux file system or dev board.